@extends('backstage.layout.master')
@section('title', '优惠劵发放')
@section('style')
<meta name="_token" content="{{csrf_token()}}"/>
<link rel="stylesheet" href="assets/css/jquery-ui-1.10.3.custom.min.css"/>
<link rel="stylesheet" href="assets/css/chosen.css"/>
<link rel="stylesheet" href="assets/css/datepicker.css"/>
<link rel="stylesheet" href="assets/css/bootstrap-timepicker.css"/>
<link rel="stylesheet" href="assets/css/daterangepicker.css"/>
<link rel="stylesheet" href="assets/css/colorpicker.css"/>
<!-- fonts -->
@stop
@section('script')
<script src="js/jquery-migrate-1.2.1.min.js"></script>
@section('script')
	<script type="text/javascript">
		$(function () {
			var channel_id=$("#channel_id").val();
		});
	</script>
@stop

@stop
@section('content')
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try {
                ace.settings.check('breadcrumbs', 'fixed')
            } catch (e) {
            }
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="backstage/home">主页</a>
            </li>

            <li class="active">
                <a href="/backstage/coupons/couponslist">优惠劵</a>
            </li>
            <li>
                优惠劵查询修改
            </li>
        </ul><!-- .breadcrumb -->

        <div class="nav-search" id="nav-search">
        </div><!-- #nav-search -->
    </div>
	
    <div class="page-content" id="load">
        <div class="row">
            <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <div class="page-header">
                  <h1>
                        优惠劵
                        <small>
                        <i class="icon-double-angle-right"></i>
                        优惠劵发放
                        </small>
                    </h1>
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                    <form class="form-horizontal" role="form" action="/backstage/coupons/binding-ch-ids-step2" method="post" enctype="multipart/form-data">
							<div class="space-4"></div>
							<div style="width:600px; float:left;">
								<div class="table-responsive">
									<table id="sample-table-1" class="table table-striped table-bordered table-hover">
											<tr>
												<td>
													礼包券渠道
												</td>
												<td>
													<input type="text" id="channel_id" name="channelId" style="width:190px;"  class="col-xs-10 col-sm-5" value="{{isset($channel->channel_id)?$channel->channel_id:''}}" readonly="true"/>
                                                    <input type="hidden" name="_token" value="{{csrf_token()}}">
                                                </td>
											</tr>
											<tr class="" data-tr-id="{{$channel->channel_id}}">
												<td>优惠劵简介</td>
												<td>
													<textarea readonly>{{isset($channel->desc)?$channel->desc:''}}</textarea>
												</td>
											</tr>
											<tr>
												<td>
													总数
												</td>
												<td>
													<input type="text" id="coupon_num" style="width:190px;" value="{{isset($channel->num)?$channel->num:''}}" class="col-xs-10 col-sm-5" readonly="true"/>
												</td>
											</tr>
											<tr>
												<td>
													可绑定优惠券
												</td>
												<td>
													<span>
														@foreach($can_use_channels as $can_use_channel)
														 @if(!empty($can_use_channel->channel_id))
                                                           {{isset($can_use_channel->channel_id)?$can_use_channel->channel_id:''}}:<input type="text" name="channel_{{isset($can_use_channel->channel_id)?$can_use_channel->channel_id:''}}" style="width:30px;float: right" value="{{isset($can_use_channel->num)?$can_use_channel->num:0}}" class="col-xs-10 col-sm-5" readonly="true"/>
														 <hr/>
                                                         @endif
														@endforeach
													</span>
												</td>
											</tr>
                                        <tr>
                                            <td>
                                                数量不足优惠券
                                            </td>
                                            <td>
											<span>
												@foreach($less_than_channels as $less_than_channel)
                                                   @if(!empty($less_than_channel->channel_id))
                                                      {{isset($less_than_channel->channel_id)?$less_than_channel->channel_id:''}}:<input type="text" style="width:30px;float: right" value="{{isset($can_use_channel->num)?$can_use_channel->num:0}}" class="col-xs-10 col-sm-5" readonly="true"/>
                                                   <hr/>
                                                   @endif
                                                @endforeach
											</span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                不能用优惠券
                                            </td>
                                            <td>
											<span>
												@foreach($un_use_channels as $un_use_channel)
                                                    @if(!empty($un_use_channel))
                                                        {{$un_use_channel.','}}
                                                        <hr/>
                                                    @endif
                                                @endforeach
											</span>
                                            </td>
                                        </tr>
									</table>
								 </div>
                            <div class="clearfix form-actions" >
                                <div class="col-md-offset-3 col-md-9">
                                    <button  class="btn btn-info" type="submit">
                                        <i class="icon-download-alt bigger-110"></i>
										保存
                                    </button>
                                    <button id="generate" class="btn generate" type="button">
                                        <i class="icon-bar-chart bigger-110"></i>
                                        <a href="/backstage/coupons/binding-ch-ids-step1?id={{isset($channel->channel_id)?$channel->channel_id:''}}" >返回上一级</a>
                                    </button>
                                </div>
                            </div>
								</div>
                        </form>
                    </div><!-- /.col -->
                </div>
                <!-- PAGE CONTENT ENDS -->
            </div><!-- /.col -->
        </div><!-- /.row -->
		</div>
@stop
